package system

import (
	"5title_gin/internal/service/system"
	"5title_gin/pkg/utils/http"
	"github.com/gin-gonic/gin"
	"go.uber.org/zap"
)

type OssAPI struct {
	service *system.OssService
}

func NewOssAPI() *OssAPI {
	return &OssAPI{
		service: system.NewOssService(),
	}
}
func (api *OssAPI) UploadView(c *gin.Context) {
	url, err := api.service.UploadImg(c)
	if err != nil {
		zap.S().Errorf("上传失败 %s", err)
		http.FailWithError(err, c)
		return
	}
	http.OkWithData(url, c)
}
